+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
+Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
+ font hash table, if we have a GdkFontPrivate entry for this font
+ already, simply increment its reference count, provided by Olaf Dietsche
+ <olaf.dietsche+list.gtk@netcologne.de>.
+
+ * gtk/gtkstyle.c (gtk_style_copy): plug a GdkFont reference leak, fix
+ provided by Olaf Dietsche <olaf.dietsche+list.gtk@netcologne.de>.
+
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
{
GdkFont *font;
GdkFontPrivate *private;
+ XFontStruct *xfont;
- private = g_new (GdkFontPrivate, 1);
- font = (GdkFont*) private;
+ g_return_val_if_fail (font_name != NULL, NULL);
- private->xdisplay = gdk_display;
- private->xfont = XLoadQueryFont (private->xdisplay, font_name);
- private->ref_count = 1;
+ xfont = XLoadQueryFont (gdk_display, font_name);
+ if (xfont == NULL)
+ return NULL;
- if (!private->xfont)
+ font = gdk_font_lookup (xfont->fid);
+ if (font != NULL)
{
- g_free (font);
- return NULL;
+ private = (GdkFontPrivate *) font;
+ if (xfont != private->xfont)
+ XFreeFont (gdk_display, xfont);
+
+ gdk_font_ref (font);
}
else
{
+ private = g_new (GdkFontPrivate, 1);
+ private->xdisplay = gdk_display;
+ private->xfont = xfont;
+ private->ref_count = 1;
+
+ font = (GdkFont*) private;
font->type = GDK_FONT_FONT;
- font->ascent = ((XFontStruct *) private->xfont)->ascent;
- font->descent = ((XFontStruct *) private->xfont)->descent;
- }
+ font->ascent = xfont->ascent;
+ font->descent = xfont->descent;
- gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
+ gdk_xid_table_insert (&xfont->fid, font);
+ }
return font;
}
{
GdkFont *font;
GdkFontPrivate *private;
+ XFontStruct *xfont;
- private = g_new (GdkFontPrivate, 1);
- font = (GdkFont*) private;
+ g_return_val_if_fail (font_name != NULL, NULL);
- private->xdisplay = gdk_display;
- private->xfont = XLoadQueryFont (private->xdisplay, font_name);
- private->ref_count = 1;
+ xfont = XLoadQueryFont (gdk_display, font_name);
+ if (xfont == NULL)
+ return NULL;
- if (!private->xfont)
+ font = gdk_font_lookup (xfont->fid);
+ if (font != NULL)
{
- g_free (font);
- return NULL;
+ private = (GdkFontPrivate *) font;
+ if (xfont != private->xfont)
+ XFreeFont (gdk_display, xfont);
+
+ gdk_font_ref (font);
}
else
{
+ private = g_new (GdkFontPrivate, 1);
+ private->xdisplay = gdk_display;
+ private->xfont = xfont;
+ private->ref_count = 1;
+
+ font = (GdkFont*) private;
font->type = GDK_FONT_FONT;
- font->ascent = ((XFontStruct *) private->xfont)->ascent;
- font->descent = ((XFontStruct *) private->xfont)->descent;
- }
+ font->ascent = xfont->ascent;
+ font->descent = xfont->descent;
- gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
+ gdk_xid_table_insert (&xfont->fid, font);
+ }
return font;
}
new_style->bg_pixmap[i] = style->bg_pixmap[i];
}
+ gdk_font_unref (new_style->font);
new_style->font = style->font;
gdk_font_ref (new_style->font);